package cn.yuanqiao.archive.appManager.mapper;

import cn.yuanqiao.archive.appManager.domain.TenantMdataList;
import cn.yuanqiao.archive.appManager.domain.TenantMdataListShy;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author zjj
 * @date 2023/6/25
 */
public interface TenantMdataListMapper {
    /**
     * 查询元数据明细
     *
     * @param id 元数据明细主键
     * @return 元数据明细
     */
    public TenantMdataList selectTenantMdataListById(@Param("id") Long id, @Param("tableName") String tableName);

    /**
     * 查询元数据明细列表  模糊查询
     *
     * @param tenantMdataList 元数据明细
     * @return 元数据明细集合
     */
    public List<TenantMdataList> selectTenantMdataListList(TenantMdataList tenantMdataList);

    /**
     * 查询展示列总数
     * @param tableName
     * @return
     */
    public List<String> selectTenantMdataIsHiddenSum (@Param("tableName") String tableName,@Param("ids")  String ids);
    /**
     * 查询元数据明细列表  精确查询
     *
     * @param tenantMdataList 元数据明细
     * @return 元数据明细集合
     */
    public List<TenantMdataList> selectTenantMdataListListPrecise(TenantMdataList tenantMdataList);

    /**
     * 新增元数据明细
     *
     * @param tenantMdataList 元数据明细
     * @return 结果
     */
    public int insertTenantMdataList(TenantMdataList tenantMdataList);

    /**
     * 修改元数据明细
     *
     * @param tenantMdataList 元数据明细
     * @return 结果
     */
    public int updateTenantMdataList(@Param("tenantMdataList") TenantMdataList tenantMdataList, @Param("ids") String ids);

    /**
     * 删除元数据明细
     *
     * @param id 元数据明细主键
     * @return 结果
     */
    public int deleteTenantMdataListById(@Param("id") Long id, @Param("tableName") String tableName);

    /**
     * 删除元数据明细
     *
     * @param id 元数据明细主键
     * @return 结果
     */
    public int deleteTenantMdataListByGroupId(@Param("groupId") Long groupId, @Param("tableName") String tableName);

    /**
     * 批量删除元数据明细
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteTenantMdataListByIds(@Param("ids") Long[] ids, @Param("tableName") String tableName);

    String copyIsRepeat(@Param("tenantMdataList") TenantMdataList tenantMdataList, @Param("ids") String ids);

    List<TenantMdataList> getDataListsByIds(@Param("ids") String ids, @Param("tableName") String tableName);

    TenantMdataList isExist(TenantMdataList tenantMdataList);

    int careateMdataListTable(@Param("tableName") String tableName);

    void initMdataList(@Param("tableName")String tableName, @Param("categoryIds") String categoryIds);

    List<TenantMdataList> getMdataListModel(Long groupId);

    List<Map<String, Object>> getdictfield(@Param("categoryId")Long categoryId, @Param("catetableName") String tableName, @Param("mdatalisttableName") String mdatalisttableName, @Param("level") Integer level);

    List<TenantMdataList> selectTenantMdataListListByCategoryId(@Param("data") TenantMdataList data, @Param("categoryId") Long categoryId, @Param("categoryTabName") String categoryTabName);

    List<TenantMdataList> selectNotEmptyDefaultByCategoryId(@Param("data") TenantMdataList data, @Param("categoryId")Long categoryId, @Param("categoryTabName") String categoryTabName);

    List<TenantMdataList> selectByFieldName(@Param("selectCol")List<String> selectCol, @Param("data") TenantMdataList select);

    List<TenantMdataList> selectSpecialCharacter(TenantMdataList tenantMdataList);

    List<Map<String,Object>> selectYqdaMdataListListforshy(@Param("groupId")Long groupId, @Param("type")Integer type, @Param("fieldCaption")String fieldCaption, @Param("fieldName")String fieldName, @Param("categoryId")Long categoryId, @Param("tableName1")String tableName1, @Param("tableName2")String tableName2);

    Long selectshybyid(@Param("mdataid")Long mdataid, @Param("type") Integer type, @Param("groupId") Long groupId, @Param("categoryId") Long categoryId, @Param("tableName")String tableName);

    int addmdatatoshy(TenantMdataListShy yqdaMdataListShy);

    int deletemdatafromshy(TenantMdataListShy yqdaMdataListShy);

    List<TenantMdataListShy> mdataShyList(@Param("categoryId")Long categoryId);

    int getNumByFieldName(@Param("tenantMdataList")TenantMdataList tenantMdataList,@Param("tableName")String tableName);

    List<TenantMdataList> selectTenantMdataListListforexport(@Param("groupId")Long groupId,@Param("type") Integer type,@Param("fieldName") String fieldName,@Param("ids") List ids,@Param("tableName")String tableName);
}
